<!DOCTYPE html>
<html>

<head lang='zh'>
	<meta charset='utf-8'>
	<meta http-equiv="X-UA-Compatible" content="IE=edge" />
	<meta name="renderer" content="webkit" />
	<meta name="viewport" content="width=device-width, initial-scale=1,user-scalable=0" />
	<title>Luckysheet</title>

	<link rel='stylesheet' href='./plugins/css/pluginsCss.css' />
	<link rel='stylesheet' href='./plugins/plugins.css' />
	<link rel='stylesheet' href='./css/luckysheet.css' />
	<link rel='stylesheet' href='./assets/iconfont/iconfont.css' />
	<script src="./plugins/js/plugin.js"></script>

	<!-- rollup luckysheet.js -->
	<script src="./luckysheet.umd.js"></script>
    <style>
		#container {
            overflow: auto;
            position: relative;
            height: 100%;
        }

        .btn button,
        input {
            margin-left: 10px;
            margin-top: 8px;
        }
	</style>
</head>

<body>
	<div id="luckysheet" style="margin:0px;padding:0px;position:absolute;width:100%;height:88%;left: 0px;top: 50px;"></div>
    <div class="btn">
		<button class="getVal">获取单元格数据</button>
		<button class="setVal">设置单元格数据</button>
		<button class="resetVal">重置单元格数据</button>
		<button class="delVal">删除单元格数据</button>
		<button class="findVal">查找单元格数据</button>
		<button class="createVal">生成报表数据</button>
	</div>
	<!-- demo feature, non-production use -->
	<script src="./demoData/demoFeature.js"></script>

	<script>
		
		let lang = luckysheetDemoUtil.language() === 'zh' ? 'zh' : 'en';
        // document.querySelector('#container').style.height = window.innerHeight + 'px';
        let getValBtn = document.querySelector(".getVal")
        let setValBtn = document.querySelector(".setVal")
        let resetValBtn = document.querySelector(".resetVal")
        let delValBtn = document.querySelector(".delVal")
        let findValBtn = document.querySelector(".findVal")
        let createValBtn = document.querySelector(".createVal")
        getValBtn.addEventListener("click",()=>{
            console.log( luckysheet.getCellValue(0, 0))
        })
        setValBtn.addEventListener("click",()=>{
             luckysheet.setCellValue(0, 0, 1)
        })
        resetValBtn.addEventListener("click",()=>{
             luckysheet.clearCell(0, 0)
        })
       delValBtn.addEventListener("click",()=>{
            let res = luckysheet.deleteCell('left',0,0,{success:function(){
              console.log('delval')
			}})
        })
       delValBtn.addEventListener("click",()=>{
            let res = luckysheet.deleteCell('left',0,0,{success:function(){
              console.log('delval')
			}})
        })
	   createValBtn.addEventListener("click",()=>{
            luckysheet.refresh({success:function(){
				console.log(123456)
			}})
       })
		findValBtn.addEventListener("click",()=>{
			console.log(123)
			// let res = luckysheet.find("指标")
			// let res = luckysheet.replace("指标", "")
			let res = luckysheet.getRange()
			console.log(res)
        })
		$(function () {
            //Configuration item
            var options = {
                container: 'luckysheet', //luckysheet is the container id
				showinfobar: false,
				lang:"zh",
				hook:{
					cellEditBefore:function(r,c,v){
                    //   console.log('r,c,v')
                    //   console.log(r,c,v)
					},
				}
            }
            luckysheet.create(options)
        });
	</script>
	
</body>

</html>